﻿@inject NavigationManager NavigationManager
@inject IJSRuntime JsRuntime

<tr>
    @if (ProjectDto is null){}
    else
    {
        <td>
            <CompUpdateIcon Roles="admin,pm,mgr" Url="@($"project/update/{ProjectDto.Id}")" />
            <a href="/drawings/@ProjectDto.Id">@ProjectDto.OdpNumber</a>
        </td>
        <td>@ProjectDto.Name</td>
        <td style="text-align: center">@ProjectDto.Designer</td>
        <td style="text-align: center">@ProjectDto.ProjectType</td>
        @*根据风险值更改颜色*@
        <td style="text-align: center">
            <CompRiskLevel Risk="@ProjectDto.RiskLevel"/>
        </td>
        <td style="text-align: center">
            <CompPdfFile PdfUrl="@ProjectDto.ContractUrl" UploadUrl="@($"project/uploadfiles/{ProjectDto.Id}")" />
        </td>
        <td style="text-align: center">
            <CompPdfFiles PdfUrls="@ProjectDto.BomUrl" UploadUrl="@($"project/uploadfiles/{ProjectDto.Id}")"/>
        </td>
        <td style="text-align: center">
            <span @onclick="Show" hidden="@(string.IsNullOrWhiteSpace(ProjectDto.SpecialNotes))">@(_showSpecialNotes ? "▲" : "▼")</span>
        </td>
    }
</tr>
@if (_showSpecialNotes)
{
    <tr>
        <td colspan="8" style="color: red">
            <CompMultiLineText Text="@ProjectDto.SpecialNotes"/>
        </td>
    </tr>
}

@code {
    [Parameter]
    public ProjectDto? ProjectDto { get; set; }
    private bool _showSpecialNotes = false;
    private void Show()
    {
        _showSpecialNotes = !_showSpecialNotes;
    }
}
